package com.htrq.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.htrq.entity.HRole;
import com.htrq.entity.Page;

@Repository
public class HRoleDao extends BaseDaoImpl<HRole> {
	public List<HRole> getAllByPage(Page page) {
		Query query = getCurrentSession().createQuery("from HRole");
		query.setFirstResult(page.getStart());
		query.setMaxResults(page.getLimit());
		return query.list();
	}

	public Long getTotal() {
		return getCount("select count(*) from HRole");
	}

	public List<HRole> getAll() {
		return findAll("from HRole");
	}
}
